//
// Description: 数据结构定义
// Created by Loading on 2021/7/21.
//

#ifndef PROBLEMS_DATA_STRUCTURE_DEFINITION_H
#define PROBLEMS_DATA_STRUCTURE_DEFINITION_H

// Definition for a binary tree node.
// 二叉树
struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;

    TreeNode() : val(0), left(nullptr), right(nullptr) {}

    explicit TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}

    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};

// Definition for singly-linked list.
// 链表
struct ListNode {
    int val;
    ListNode *next;

    ListNode() : val(0), next(nullptr) {}

    explicit ListNode(int x) : val(x), next(nullptr) {}

    ListNode(int x, ListNode *next) : val(x), next(next) {}
};

// Definition for a Node.
// 带随机指针的链表 (138. 复制带随机指针的链表)
class Node {
public:
    int val;
    Node *next;
    Node *random;

    explicit Node(int _val) {
        val = _val;
        next = nullptr;
        random = nullptr;
    }
};

#endif //PROBLEMS_DATA_STRUCTURE_DEFINITION_H
